// pub use T 导出了 T，T 可以被其他 crate 使用；pub (crate) use T 只把 T 导出到当前的 crate，其他 crate 访问不了。
// 此trait必需定义为pub公开的，否则在外部无法调用成功
pub trait Animal {
    fn eat(&self);
}

pub(crate) struct Tiger {
    name: String,
}

impl Tiger {
    pub(crate) fn new(name: &str) -> Self {
        Tiger { name: name.parse().unwrap() }
    }
}

pub(crate) struct Cat {
    name: String,
}

impl Cat {
    pub(crate) fn new(name: String) -> Self {
        Cat { name }
    }
}

impl Animal for Tiger {
    fn eat(&self) {
        println!("{} eat rabbit...", self.name);
    }
}

impl Animal for Cat {
    fn eat(&self) {
        println!("{} eat mouse...", self.name);
    }
}